<template>
    <el-menu-item :index="menu.path||menu.id.toString()" @click="addTab(menu)" class="bg_white"
        v-if="typeof(menu.children)=='undefined' || menu.children.length==0">
        <i :class="'iconfont icon-' + menu.iconCls"></i>{{menu.label}}
    </el-menu-item>
    <el-submenu v-else="menu.children.length>0" :index="menu.id.toString()">
        <template slot="title"><i :class="'iconfont icon-' + menu.iconCls"></i>{{menu.label}}</template>
    <el-menu-tree v-for="m in menu.children" :menu="m" :key="m.id"></el-menu-tree>
  </el-submenu>
</template>
<script>
    export default {
        name: "el-menu-tree",
        props: {
            menu: {
                default() {
                  return {};
               }
            }
        },
        methods: {
            addTab(menu){
				// console.log("我要添加tab1111111111", menu);
				eventBus.$emit('addTab', menu.id, menu.label, menu.otherValue);
			}
        }
    }
</script>